;(function($,COMP){
	
	if(COMP.wantedSpecialCar){
		return;
	}
	
	COMP.wantedSpecialCar = function(){
		
		//给所有的图片和按钮绑定 快速登录注册函数；
		$("#wantedSpecial .vote-btn").on("click",function(){
			window._clickThisBtn=$(this);
			window.carType.vote = $("#wantedSpecial .vote-btn").index(this);
			window.backCallName = 'voteFun';
		});
		
		//查看规则
		$('.look-rule-btn').on('mouseover',function(){
			$('.look-rule-img').show();
		});
		
		$('.look-rule-btn').on('mouseout',function(){
			$('.look-rule-img').hide();
		});
		


		/*快速注册登录成功后的回调函数*/
		window.carType = {
			current :'',
			forcast:'',
			vote:''
		};
		window.activityCode || (window.activityCode = "第十九期特殊车20150120");
		window._clickThisBtn = '';

		//提交投票车型
		window.voteFun = function(){
			
			var param={};
			param['activityName']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('activityName');
			param['velBrandId']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('velBrandId');
			param['brandName']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('brandName');
			param['velSeriesId']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('velSeriesId');
			param['velSeriesName']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('velSeriesName');
			param['velModelId']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('velModelId');
			param['velModelName']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('velModelName');
			param['areaType']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('areaType');
			param['promotionId']  = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('promotionId');
			param['cityId']  = _getCookie("city.id");
			param['activityNo'] = $(".bindCheckLogin",".half-price-box").eq(window.carType.vote).attr('activityNo');
			$.ajax({
				url:"/promotion/saveProUserInfo.htm",
				type: "POST",
				data: param,
				dataType: "json",
				contentType: "application/x-www-form-urlencoded; charset=utf-8",
				success: function(data){
					if(data>0){	//点击后人数增加
						var oZhiChi=parseInt(_clickThisBtn.siblings('.vote-num-box').find('.vote-num').text())+1;
						_clickThisBtn.next().text(oZhiChi+"人支持");
						//投票后按钮置灰
						_clickThisBtn.attr("class","vote-btn-grey");
						_clickThisBtn.text("已投票");
						_clickThisBtn.off("click");
						ECar.easyDialog.open({
							callback : function(){
								window.location.reload();
							},
							container : {
								header : '提示',
								content : '<div style="text-align:center">投票成功</div>'
							}
							//callback:isLogin
						});
					}else if(data==-2){
						//投票后按钮置灰
						_clickThisBtn.attr("class","vote-btn-grey");
						_clickThisBtn.text("已投票");
						_clickThisBtn.off("click");
							ECar.easyDialog.open({
								callback : function(){
									window.location.reload();
								},
								container : {
									header : '提示',
									content : '<div style="text-align:center">您已经参加过投票，不能重复操作！</div>'
								}
								//callback:isLogin
						});
					}else if(data==-3){
						//投票后按钮置灰
						//_clickThisBtn.attr("class","vote-btn-grey");
						_clickThisBtn.text("投票");
						_clickThisBtn.off("click");
							ECar.easyDialog.open({
								callback : function(){
									window.location.reload();
								},	
								container : {
									header : '提示',
									content : '<div style="text-align:center">当前您投票次数已超限制，感谢您的参与。</div>'
								}
								//callback:isLogin
						});
					}else{
						//投票后按钮置灰
						_clickThisBtn.attr("class","vote-btn-grey");
						_clickThisBtn.text("投票");
						_clickThisBtn.off("click");
							ECar.easyDialog.open({
								callback : function(){
									window.location.reload();
								},
								container : {
									header : '提示',
									content : '<div style="text-align:center">网络异常，请稍后再试！</div>'
								}
								//callback:isLogin
						});
					}
				},
				error: function(){
					ECar.easyDialog.open({
						callback : function(){
							window.location.reload();
						},
						container : {
							header : '提示',
							content : '<div style="text-align:center">未提交成功，请稍后再试</div>'
						}
					});
				}
			});
		};
		
	};
	
	COMP.wantedSpecialCar();

})(jQuery,window.COMP||(window.COMP={}));
